﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sustainalytics.Entities.RiskRatings;
using Sustainalytics.Reporting.Framework;
using Sustainalytics.RiskRatings.Reporting.Headers_and_Footers;

namespace Sustainalytics.RiskRatings.Reporting
{
    class PdfReportPage_MaterialIssues : PdfReportPage
    {
        public PdfReportPage_MaterialIssues(PdfReport report, ReportDataSource _datasource, RiskRatingMaterialEsgIssueBase materialIssue, byte[] materialIssueImage) : base(report)
        {
            MeiPageHeader objHeader = new MeiPageHeader();
            objHeader.Left = 0;
            objHeader.Top = -9;
            objHeader.Width = report.PageMaxWidth;
            objHeader.Height = 80;
            objHeader.CompanyName = _datasource.CompanyProfile.CompanyName;
            objHeader.SubPeerGroup = _datasource.CompanyProfile.SubPeerGroup;
            objHeader.Country = _datasource.CompanyProfile.Country;
            objHeader.ExchangeTicker = _datasource.CompanyProfile.ExchangeTicker;
            objHeader.MeiName = materialIssue.Name;
            objHeader.MeiDescription = _datasource.MEIDescriptions.FirstOrDefault(x => x.Id == materialIssue.ExternalId)?.Description;
            objHeader.Description = materialIssue.Description;
            objHeader.MeiIssueWeight = (float)materialIssue.FinalWeight.Value;
            objHeader.MeiImage = materialIssueImage;
            objHeader.MeiType = materialIssue.Type;
            Elements.Add(objHeader);
            Top += 80;
        }
    }
}
